x86/physmap: Prevent incorrect updates of m2p mappings
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 14 Nov 2012 11:36:02 +0000 (11:36 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 14 Nov 2012 11:36:02 +0000 (11:36 +0000)
commitef3cea268fdff77f93368369c5998b1c975aa297
tree35a206cfed76a442dd8400ef354d469bef2d0916
parentdfa0cb6a14b3c835e643f56b620137b5aff3e1c1
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen/arch/x86/mm/p2m.c